<?php 
/**
 * File: View - Categorias - index.phtml
 */
 
 $this->jQuery()
	 ->addJavascriptFile( $this->layout_base . '/third/js/tree.menu.js')
	 ->addJavascriptFile( $this->layout_base . '/third/js/modules/categorias.js');
	 
	$this
	->headLink()
	->appendStylesheet( $this->layout_base . '/third/css/categorias.css');
 
?>
			<div class="page-title ui-widget-content ui-corner-all">
				<div>
						<div class="float-left">
							<br />
							<h1><?php echo $this->moduleTitle ?></h1>
						</div>
						<div class="clearfix"></div>
				</div>

				<div id="main-itens-content" class="hastable other" >
				
				<?php echo($this->flashMessages()); ?>

						<div class="portlet ui-widget ui-widget-content ui-helper-clearfix ui-corner-all">
							<div class="portlet-header">Adiciona categoria</div>
							<div class="portlet-content">
				<form name="listFormCategorias" class="pager-form" method="post" action="/third/categorias/add">
				<table>
					<thead><th>Titulo</th><th>Pai</th><th>tipo</th><th>&nbsp;</th></thead>
					<tr>
						<td><?php echo $this->formText(array('name'=>'titulo'))?></td>
						<td><?php echo $this->formSelect('pai','','', $this->categoriasSimples )?></td>
						<td><?php echo $this->formSelect('tipo','','', $this->tipos)?></td>
						<td><input type="submit" name="save" value="Adicionar categoria" class="btn ui-state-default ui-icon-circle-plus" /></td>
					</tr>
				</table>
				</form>
				<div class="clearfix"></div>
					</div>
				</div>	
<br class="clearfix" />
				<div>
			<?php 
				$this->placeholder('sidebar')->captureStart('SET', 'data');
			?>
						<div class="portlet ui-widget ui-widget-content ui-helper-clearfix ui-corner-all">
							<div class="portlet-header">Categorias</div>
							<div class="portlet-content">
							<ul id="categorias_tree_content" class="icontent_tree">
								<li id="node0" noDrag="true" noSiblings="true" noDelete="true" noRename="true"><a href="#">Menu</a>
								<?php 
									if( $this->categorias ){
										echo Third_Funcs::arrayToULEdit( $this->categorias, '/third/categorias/index/id/' );
									}
								?>
								</li>
							</ul>
							
						<form>
							<input type="button" onclick="saveMyTree()" value="Save">
						</form>
						<script type="text/javascript">	
						$(document).ready(function() { 
							
							treeObj = new JSDragDropTree();
							treeObj.setTreeId('categorias_tree_content');
							treeObj.setMaximumDepth(6);
							treeObj.setMessageMaximumDepthReached('Voc&ecirc; s&oacute; pode inserir 3 subn&iacute;veis'); // If you want to show a message when maximum depth is reached, i.e. on drop.
							treeObj.initTree();
							treeObj.expandAll(10);
						});
						</script>
						<a href="#" onclick="treeObj.collapseAll()">Esconder</a> | 
						<a href="#" onclick="treeObj.expandAll()">Expandir</a>
						
				</div>
			</div>
		<?php 
			$this->placeholder('sidebar')->captureEnd();
		?>		

						<div class="portlet">
							<div class="portlet-header">Editar Categorias</div>
							<div class="portlet-content" id="categorias-edit">
								<?php 
									if( $this->id )
										echo $this->action('edit','categorias','third', array('id'=>$this->id) );
								?>
							</div>
						</div>

					

				</div>
				</div>
				
					
				<div class="clearfix"></div>
			</div>
